<!DOCTYPE html>
<html lang="zh">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Vue.set全局操作</title>
  <script src="../assets/js/vue.js"></script>
</head>

<body>
  <h1>Vue.set全局操作</h1>
  <hr>
  <div id="app">
    {{count}}
    <ul>
      <li v-for="item in arr">{{item}}</li>
    </ul>
  </div>
  <p>
    <button onclick="add()">add</button>
  </p>
  <script type="text/javascript">
    function add() {
      // Vue.set(outData,'count',2);
      // app.count++;
      // outData.count++;
      // app.arr[1]='ddd';
      Vue.set(app.arr,1,'ddset');
    }
    var outData = {
       count: 1,
      // goods: 'car'
      arr:['aaa','bbb','ccc']
    }
    var app = new Vue({
      el: '#app',
      data: outData
    })
  </script>
</body>

</html>